package com.surprise.bweb.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.common.collect.Lists;
import com.surprise.bweb.vo.SelectItemVO;
import com.surprise.db.dao.CategoryDAO;
import com.surprise.db.po.Category;

/**
 * CategoryManager.java
 * @author nick
 * @since 2015年9月1日
 */
@Component
public class CategoryManager {
	@Autowired
	private CategoryDAO categoryDAO;
	
	public List<SelectItemVO> getCategoryByType(int type) {
		List<SelectItemVO> ret = Lists.newArrayList();
		List<Category> pos = categoryDAO.getListByType(type);
		for (Category po : pos) {
			ret.add(new SelectItemVO().setText(po.getName()).setValue(
					po.getSequence() + ""));
		}
		return ret;
	}
}
